import axios from "axios";

export default function CinemaAction() {
    // 返回的是一个thunk函数  dispatch参数: Redux Thunk中间件将真正的dispatch方法作为参数传给thunk函数
    return (dispatch) => {
        axios({
            url: 'https://m.maizuo.com/gateway?cityId=110100&ticketFlag=1&k=4281971',
            headers: {
                'X-Client-Info': '{"a":"3000","ch":"1002","v":"5.2.1","e":"1759065151917503798673409"}',
                'X-Host': 'mall.film-ticket.cinema.list'
            }
        }).then(res => {
            // 真正将数据提交给store的地方
            dispatch({type: "queryCinemaList", payload: res.data.data.cinemas});
        })
    }
}